//
//  ShoppingCarGoodsCell.m
//  WeiWeiHaircut
//
//  Created by 超群 on 15/10/14.
//  Copyright © 2015年 超群. All rights reserved.
//

#import "ShoppingCarGoodsCell.h"
#import "UIView+RoundView.h"

#import "UIImageView+WebCache.h"
#import "QZShopCarModel.h"
@interface ShoppingCarGoodsCell ()
@property (weak, nonatomic) IBOutlet UIImageView *liefImageView;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
@property (weak, nonatomic) IBOutlet UILabel *pricXian;
@property (weak, nonatomic) IBOutlet UILabel *pricYuan;

@end

@implementation ShoppingCarGoodsCell

- (void)awakeFromNib {
    [self.contentView setlineFrame:CGRectMake(0, 0.5f, WIDTH, .5f) lineColor:groupDarkGrayColor lineAlpha:1];
    [self.contentView setlineFrame:CGRectMake(0, 109.5f, WIDTH, .5f) lineColor:groupDarkGrayColor lineAlpha:1];
    
    UIView* lineview = [[UIView alloc]initWithFrame:CGRectMake(0, 110, WIDTH, 5.f)];
    lineview.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:lineview];
    
    [self.selectButton setImage:[UIImage imageNamed:@"选中"] forState:UIControlStateSelected];
    [self.selectButton setImage:[UIImage imageNamed:@"椭圆-7-拷贝-3"] forState:UIControlStateNormal];
    

    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setShopModel:(QZShopCarModel *)shopModel{
    
    _shopModel = shopModel;
    
    
    [_liefImageView sd_setImageWithURL:[NSURL URLWithString:shopModel.img] placeholderImage:[UIImage imageNamed:@"1123.jpg"]];
    
    _titleLabel.text = shopModel.prodTitle;
    
    _pricXian.text = [NSString stringWithFormat:@"%.2lf",shopModel.price2];
    
    _pricYuan.text = [NSString stringWithFormat:@"%.2lf",shopModel.price2];
    
    _numberLabel.text = [NSString stringWithFormat:@"%ld",shopModel.amount];
    
    _shopModel.prodMoney = shopModel.amount * shopModel.price2 ;//总价
    _selectButton.selected = shopModel.isSelect;

    
}

- (IBAction)addButton:(id)sender {
    if (_changeBlock) {
        _changeBlock(sender);
    }
    
}


- (IBAction)subbutton:(id)sender {
    if (_changeBlock) {
        _changeBlock(sender);
    }
    
}

@end
